This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
Try this code that uses the Notes C API (with acknowledgements to Tim Siney of Lovat Lane, London):
In global declarations:
Declare Private Function W32_NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" (Byval PathName As Lmbcs String, hDB As Integer) As Integer
Declare Private Function W32_DesignRefresh Lib "nnotes" Alias "DesignRefresh" _
(Byval ServerName As Lmbcs String, Byval hDB As Integer, Byval dwFlags As Long, _
Byval abortCheck As Integer, Byval messageProc As Integer) As Integer
Declare Private Function W32_NSFDbClose Lib "nnotes" Alias "NSFDbClose" (Byval hDB As Integer) As Integer
Function checkForUpdate( profile As NotesDocument, Server As String )
Dim version As String
Dim templateVersion As String
Dim sprofile As NotesDocument
If profile Is Nothing Then Exit Function
version = profile.BookmarkVersion(0)
Print "Checking for bookmark updates . . ."
'now get the version from the template on the server
Dim templateDb As New NotesDatabase( Server, "Templates/Bookmark.ntf" )
If Not templateDb Is Nothing Then
Set sprofile = templateDb.GetProfileDocument( "frmSetup" )
If Not sprofile Is Nothing Then
templateVersion = sprofile.BookmarkVersion(0)
If templateVersion > version Then
' Messagebox "Your computer needs to be updated with the latest version of the Home page", 64, "Please wait a few moments"
Print "Program upgrade - Your computer needs to be updated with the latest version of the Home page."
Call refreshDesign( db, Server )
Call profile.ReplaceItemValue( "BookmarkVersion", templateVersion )
Call profile.Save( True, False )
' Messagebox "Changes will take effect the next time you restart your Lotus Notes.", 64, "Thank you - all done successfully."
Print "Update successful - Changes will take effect the next time you restart your Lotus Notes."
End If
End If
End If
End Function
Function refreshDesign( SourceDb As NotesDatabase, refreshServer As String ) As Boolean
Dim s As New notesSession
Dim destPath As String
Dim rc As Integer
Dim hDb As Integer
On Error Resume Next
If Not sourceDb.isOpen Then Call sourceDb.open("", "") ' Make sure the source database exists
If Not sourceDb.isOpen Then Set sourceDb = Nothing
On Error Goto 0
If Err <> 0 Then Set sourceDb = Nothing
If sourceDb Is Nothing Then Exit Function ' ==== Exit if source db doesn't exist or couldn't be opened ====
' Build the API path to the file
If sourceDb.server = "" Then
destPath = sourceDb.filePath
Else
destPath = sourceDb.server & "!!" & sourceDb.filePath
End If
rc = W32_NSFDbOpen(destPath, hDb) ' Open the db in the API and get a handle to the open db
If rc <> 0 Then ' Return Code zero on success, non-zero on failure
' Msgbox "Database Could Not Be Opened - Error Code " & Cstr(rc), 16, "Error"
notify = notify + "Design Refresh - Bookmark.nsf Could Not Be Opened - Error Code " & Cstr(rc) + " for " + session.CommonUserName + Chr(10)
Else
rc = W32_DesignRefresh(refreshServer, hDb, 0, 0, 0)
If rc <> 0 Then
' Msgbox "Database Could Not Be Refreshed - Error Code " & Cstr(rc), 16, "Error"
notify = notify + "Local Bookmark database Could Not Be Refreshed - Error Code " & Cstr(rc) + " for " + session.CommonUserName + Chr(10)
End If
Call W32_NSFDbClose(hDb)
End If
End Function
We use this to push bookmark.nsf design changes to thousands of Notes clients across Australia & the UK.
Put the code into the bookmark.nsf that you deploy with your next Notes upgrade, so that it is called in the post open event of the Database script. (Add some error checking.)
Warning: it can be a bit slow for the user to refresh the design over a slow dial-up. We check the local IP address for the subnet and only perform the design refresh if the Notebook is on a LAN with a local server that contains the template.
Hope you all find this useful.
Feedback response number WEBB7CPTBG created by ~Helga Rerepulakol on 03/13/2008